#     Goblinoid: Experience all of MediaGoblin on an Android Device
#     Copyright (C) 2015 Dylan Jeffers 
# 
#     This program is free software: you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation, either version 3 of the License, or
#     (at your option) any later version.
# 
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
# 
#     You should have received a copy of the GNU General Public License
#     along with this program.  If not, see <http://www.gnu.org/licenses/>.


<LoginInput@TextInput>:
    background_color: [1,1,1,0.15]
    foreground_color: [1,1,1,1]
    hint_text_color: [1,1,1,1]
    font_size: sp(20)
    size_hint_y: None
    height: self.minimum_height
    multiline: False
    padding_y: sp(17) 
    padding_x: sp(10)


<LoginButton@Button>:
    background_normal: ''
    background_down: 'atlas://data/images/defaulttheme/button'
    background_color: utils.get_color_from_hex("#86D4B1")
    bold: True
    font_size: sp(20)
    size_hint_y: None


<LoginScreen>:
    BoxLayout:
        orientation: 'horizontal'
        BoxLayout:
            size_hint_x: 0.1
        BoxLayout: 
            orientation: 'vertical'
            spacing: sp(50)
            BoxLayout:
            Image: 
                source: 'images/mediagoblin_large.png'
                size_hint_y: None
                height: sp(65)
                allow_stretch: True
            LoginManager:
                id: sm
                transition: root.sm_transition
                screen_provider: root.screen_provider
                screen_stack: root.screen_stack
                on_webfinger: root.webfinger = self.webfinger
                on_verifier_token: root.verifier_token = self.verifier_token
            BoxLayout:
        BoxLayout:
            size_hint_x: 0.1


<LoginManager>:
    on_error_message: self.current_screen.error_message = self.error_message


<WebFinger>:
    on_error_message: login_button.text = self.error_message 
    BoxLayout:
        spacing: sp(20) 
        orientation: 'vertical'
        LoginInput:
            id: text_input
            hint_text: 'Enter Webfinger'
            on_text: root.webfinger = self.text; login_button.text = 'Login'
        LoginButton:
            id: login_button
            text: 'Login'
            height: text_input.height
            on_release: root.manager.check_webfinger(root.webfinger)
        BoxLayout:


<Verify>:
    on_error_message: token_button.text = self.error_message
    BoxLayout:
        spacing: sp(20) 
        orientation: 'vertical'
        LoginInput:
            id: token_input
            hint_text: 'Paste Verifier Token'
            on_text: root.verifier_token = self.text; token_button.text = 'Enter'
        LoginButton:
            id: token_button 
            text: 'Enter'
            height: token_input.height
            on_release: root.manager.check_token(root.verifier_token)
        BoxLayout:
